<?php

namespace zhtfrontend\models\datas;

use Yii;

/**
 * This is the model class for table "{{%class_manage_time}}".
 *
 * @property integer $class_id
 * @property integer $class_day
 * @property string $start_time
 * @property string $end_time
 * @property integer $classroom_attr_id
 */
class ClassManageTime extends \zhtfrontend\components\bases\BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%class_manage_time}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['class_id', 'class_day', 'classroom_attr_id','room_id'], 'integer'],
            [['start_time', 'end_time'], 'string', 'max' => 10],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'class_id' => Yii::t('zhtfrontend', '班级id'),
            'class_day' => Yii::t('zhtfrontend', '星期'),
            'start_time' => Yii::t('zhtfrontend', '开始上课时间'),
            'end_time' => Yii::t('zhtfrontend', '结束上课时间'),
            'classroom_attr_id' => Yii::t('zhtfrontend', '时间id'),
            'room_id' => Yii::t('zhtfrontend', '教室id'),
        ];
    }

    public function getClassmanage(){
        return $this->hasOne(ClassManage::className(),['class_id'=>'class_id'])->where(['dmd_class_manage.status'=>1]);
    }
}
